import request from './request.js'

const key = '546a4def8f851e89992cee9c30066633'

//通过 ip 地址查询所在城市
export const getIpCity = () => {
  return request({
    method: 'GET',
    url: '/ip',
    params: { key },
  })
}

//通过 adcode 查询城市天气
export const getAdcodeWeather = (adcode, extensions) => {
  return request({
    method: 'GET',
    url: '/weather/weatherInfo',
    params: { key: key, city: adcode, extensions: extensions },
  })
}

//通过城市名查询 adcode
export const getSearch = (address) => {
  return request({
    method: 'GET',
    url: '/geocode/geo',
    params: { key: key, address: address },
  })
}
